import axios from "axios"

//进度条
import nprogress from "nprogress"
import "nprogress/nprogress.css"

//请求根路径 给vue实例添加网路请求方法
axios.defaults.baseURL="http://127.0.0.1:8888/api/private/v1/"

axios.interceptors.request.use(config=>{
  //开启进度条
  nprogress.start()
  config.headers.Authorization= window.sessionStorage.getItem('token')
  return config
})

axios.interceptors.response.use(config=>{
  // 关闭进度条
  nprogress.done()
  return config
})

export default axios